#include "sise.h"
#include "sise_packer.h"

#include <stdio.h>

int main(int argc, char* argv[])
{
	const int BUF_SIZE = 100;
	char *hex1 = "124D0C1476A941C179D274E7";
	char bin1[BUF_SIZE];
	char bin2[BUF_SIZE];
	char hex2[BUF_SIZE];
	short s1, s2;
	float f1, f2;
	int i1, i2;
	double d1, d2;
	
	printf("sizeof(char) = %d\n", sizeof(char));
	printf("sizeof(short) = %d\n", sizeof(short));
	printf("sizeof(int) = %d\n", sizeof(int));
	printf("sizeof(long) = %d\n", sizeof(long));
	printf("sizeof(float) = %d\n", sizeof(float));
	printf("sizeof(double) = %d\n", sizeof(double));
	
	sise_nullify(hex2, BUF_SIZE);
	sise_nullify(bin1, BUF_SIZE);
	sise_nullify(bin2, BUF_SIZE);
	
	Tx tx1, tx2;
	int sizePacked;
	tx1.angle = 23.12387;
	tx1.weaponType = 2;
	tx1.hitedAttackerID = 2394870;
	tx1.th = 2929;
	tx1.hit = 1;
	
	sizePacked = sise_pack_Tx(bin1, &tx1);
	sise_bin2hex(hex2, bin1, sizePacked);
	sise_hex2bin(hex2, bin2, sizePacked);
	sise_unpack_Tx(bin2, &tx2);
	
	printf("tx1.angle = %.10f\n", tx1.angle);
	printf("tx1.weaponType = %d\n", tx1.weaponType);
	printf("tx1.hitedAttackerID = %d\n", tx1.hitedAttackerID);
	printf("tx1.th = %d\n", tx1.th);
	printf("tx1.hit = %d\n", tx1.hit);
	
	printf("sizePacked = %d\n", sizePacked);
	printf("bin1 = %s\n", bin1);
	printf("hex2 = %s\n", hex2);
	printf("bin2 = %s\n", bin2);
	
	printf("tx2.angle = %.10f\n", tx2.angle);
	printf("tx2.weaponType = %d\n", tx2.weaponType);
	printf("tx2.hitedAttackerID = %d\n", tx2.hitedAttackerID);
	printf("tx2.th = %d\n", tx2.th);
	printf("tx2.hit = %d\n", tx2.hit);
	
	return 0;
}
